﻿
@{
    ViewBag.Title = "";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<div class="rows">
    <div class="panel panel-default">
        <table class="form">
            <tr>
                <th class="formTitle">开始日期：</th>
                <td class="formValue">
                    <input id="kssj" type="text" class="form-control input-wdatepicker form-an"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" value="@(DateTime.Now.ToString("yyyy-MM-01"))" />
                </td>
                <th class="formTitle">结束日期：</th>
                <td class="formValue">
                    <input id="jssj" type="text" class="form-control input-wdatepicker form-an"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" value="@(DateTime.Now.ToString("yyyy-MM-dd"))" />
                </td>
                <th class="formTitle" style="left: 20px;">科室名称：</th>
                <td class="formValue">
                    <select id="depa" class="form-control">
                        <option value="">全部</option>
                    </select>
                </td>
                @*<th class="formTitle">大类名称：</th>
                <td class="formValue">
                    <select id="dlmc" class="form-control">
                        <option value="">全部</option>
                    </select>
                </td>*@
                <th class="formTitle">病区：</th>
                <td class="formValue" style="width:100px;">
                    <select class="form-control" id="bq" name="bq" multiple="multiple">
                        <option value="">==请选择==</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">单价金额大于：</th>
                <td class="formValue">
                    <input id="dj" name="dj"  type="number" autocomplete="off" class="form-control"/>
                </td>
                <th class="formTitle">住院号：</th>
                <td class="formValue">
                    <input id="zyh" name="zyh" type="text" autocomplete="off" class="form-control" />
                </td>


                <th class="formTitle">项目：</th>
                <td class="formValue"><input type="text" id="sfxmmc" class="form-control formClearIgnore" /></td>
                <th class="formTitle"></th>

                <td class="formValue" style="padding-left:20px;">
                    <input type="button" id="btn_search" onclick="submit();" class="btn btn-primary btn-md" value="查询" style="width:55px" />
                </td>
                <td class="formValue"></td>
            </tr>
        </table>
    </div>
</div>





<div class="ui-layout" id="layout" style="height:100%;width:100%;">
    <iframe class="ui-layout-center" style="width:100%;" id="iframerightiframerightiframerightttt" name="iframerightiframerightiframerightttt"
            scrolling="auto" allowtransparency="true" frameborder="0"></iframe>
</div>

<script type="text/javascript">
	var reportServerHOST = '@(ViewBag.ReportServerHOST)';
    var organId = '@(ViewBag.OrgId)';


 

	function submit() {
		if ($('#kssj').val().length == 0) {
			$.modalAlert("缺少开始时间", "error");
			return;
		}
		if ($('#jssj').val().length == 0) {
			$.modalAlert("缺少结束时间", "error");
			return;
		}
		if ($('#kssj').val() > $('#jssj').val()) {
			$.modalAlert("开始时间不能大于结束时间", "error");
			return;
		}
		var url = getUrl();
		url += "&OrganizeId=" + organId;
		url += "&kssj=" + $('#kssj').val();
		url += "&jssj=" + $.getDate({ date: $('#jssj').val() }) + ' 23:59:59';
		//url += "&ksmc=" + $('#depa').val();
		//url += "&dlmc=" + $('#dlmc').val();
		//url += "&xm=" + $('#xm').val();
        url += "&zyh=" + $('#zyh').val();
        url += "&ks=" + $('#depa').val();
        var dj = $('#dj').val();
        if (dj=="") {
          dj = 0;

        }
  

        url += "&dj=" + dj;
        var bq = $('#bq').val();
        if (bq == null) {
       
            url += "&bq=" +"";
        } else {
            url += "&bq=" + $('#bq').val();
        } 
		url += "&xmmc=" + $('#sfxmmc').val();
        setTimeout("$.loading(true, '正在请求报表页面...');", 10);
        $("#iframerightiframerightiframerightttt").attr('src', url);
    }

    $("#iframerightiframerightiframerightttt").load(function () {
        $.loading(false);
	});

    $(function () {
        var h = $(window).height() - 65
        $('#layout iframe').css('height', h);
		init();
    });
    $("#bq").bindSelect({
        url: "/SystemManage/BaseData/GetAuthedWardSelectJson",
    });

    $("#bq").change(function () {
        $("#btn_search").trigger('click');
    });
    //刷新列表
    function refReport() {
        $("#btn_search").trigger('click');
    }

    function getUrl() {
        var reportServerHOST = '@(ViewBag.ReportServerHOST)';
        reportServerHOST += "/ReportServer/Pages/ReportViewer.aspx?%2fHIS.Report.1%2f项目使用查询报表&rs:Command=Render";
        console.log(reportServerHOST);
		//ReportServer/Pages/ReportViewer.aspx?%2fHIS.Report.1%2f医院垫支明细&rs:Command=Render
        //获取自定义样式
        if (true) {
            if (reportServerHOST.indexOf('&rc:Stylesheet') == -1) {
                reportServerHOST += "&rc:Stylesheet=MyStyleSheet";
            }
        }
        return reportServerHOST;
    }
</script>

<script type="text/javascript">
    function init() {
        //治疗师绑定下拉框
        $("#depa").bindSelect({
            id: "ybksbm",
            text: "Name",
            url: "/ReportManage/Report/GetKsMc",
            dropdownAutoWidth: true
        });

        $('#depa').change(function () {
            submit();
        });
        //大类名称绑定下拉框
        $("#dlmc").bindSelect({
            id: "dlcode",
            text: "dlmc",
            url: "/ReportManage/Report/GetDlMc",
            dropdownAutoWidth: true
        });

        $('#dlmc').change(function () {
            submit();
        });
    }
    $('#sfxmmc').sfxmFloatingSelector({
        djDecimalPlaces: 4,
        searchType: "sfxm.yp",
        leftshift: 150, //整体左偏移
        ajaxparameters: function ($thisinput) {
            return "dllb=1,2&mzzybz=2&keyword=" + $.trim($thisinput.val());
        },
        itemdbclickhandler: function ($thistr) {
            $('#sfxmmc').val($thistr.attr('data-sfxmmc'));
            $("#sfxmmc").attr("data-sfxmmc", $thistr.find("td:eq(0)").html());
        }
    });
</script>
<script type="text/javascript">
    function init() {
        //治疗师绑定下拉框
        $("#depa").bindSelect({
            id: "Code",
            text: "Name",
            url: "/OutpatientManage/OutpatientRegSchedule/GetSysDepartmentList",
            dropdownAutoWidth: true
        });

        $('#depa').change(function () {
            submit();
        });
    }
</script>
< 